package springmvc.param.config;

import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

/**
 * description: 初始化类
 * 1. 实现 AbstractAnnotationConfigDispatcherServletInitializer 接口
 * 2. 通过方法设置配置类、访问路径，自动创建IOC容器
 */
public class SpringMVCInit extends AbstractAnnotationConfigDispatcherServletInitializer {

    @Override
    protected Class<?>[] getRootConfigClasses() {
        return new Class[0];
    }

    /**
       springmvc需要组件的配置类
     */
    @Override
    protected Class<?>[] getServletConfigClasses() {
        return new Class[]{MvcConfig.class};
    }

    /**
     *
     * Servlet DispatcherServlet
     *
     */
    @Override
    protected String[] getServletMappings() {
        return new String[]{ "/"};
    }
}
